package lormi.meipin.service.impl;


import java.util.List;

import org.springframework.stereotype.Service;

import lormi.meipin.dto.TrainedAddDto;
import lormi.meipin.dto.TrainedEditDto;
import lormi.meipin.entity.Trained;
import lormi.meipin.exception.LMException;
import lormi.meipin.service.BaseService;
import lormi.meipin.service.ITrainedService;

@Service
public class TrainedService extends BaseService implements ITrainedService{

	@Override
	public void addTrained(TrainedAddDto trainedAddDto) throws LMException {
		if (trainedMapper.insert(new Trained(trainedAddDto))<1) {
			throw new LMException(100035);
		}
	}

	@Override
	public void delTrained(Integer id) throws LMException {
		if (trainedMapper.deleteByPrimaryKey(id)<1) {
			throw new LMException(100026);
		}
	}

	@Override
	public void editTrained(TrainedEditDto trainedEditDto) throws LMException {
		if (trainedMapper.updateByPrimaryKey(new Trained(trainedEditDto))<1) {
			throw new LMException(100036);
		}
	}

	@Override
	public Trained getTrained(Integer id) {
		return trainedMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<Trained> getList(Integer userid) throws LMException {
		return trainedMapper.selectByMemId(userid);
	}

	
}




